import os

from openai import OpenAI
"""
 openai 根据图片url自动生成文案
"""
api_key = os.getenv("OPENAI_API_KEY")
client = OpenAI(
  api_key=api_key
)


response = client.responses.create(
    model="gpt-4.1-mini",
    input=[{
        "role": "user",
        "content": [
            {"type": "input_text", "text": "我是女性用户，请根据内容生成一句简单的朋友圈文案，不要文艺，不要抒情，像朋友聊天一样自然真实，控制在40字以内， 请用中文日语英语三种语言一起写 "},
            {
                "type": "input_image",
                "image_url": "https://static.hitalk123.com/upload/post/p-20250517/0d7a9613573b4739b520d950bd8132e2.jpg",
            },
        ],
    }],
)

print(response.output_text)